




<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>新用户注册</title>
<!-- Bootstrap -->
<link href="{SHUAFEN_STATICS_PATH}css/bootstrap.min.css"
	rel="stylesheet">
<link href="{SHUAFEN_STATICS_PATH}css/profile_style.css" rel="stylesheet">
<link href="{SHUAFEN_STATICS_PATH}css/response.css" rel="stylesheet">
<link href="{SHUAFEN_STATICS_PATH}css/bootstrapValidator.css"
	rel="stylesheet">
<link href="{SHUAFEN_STATICS_PATH}css/default.css"
	rel="stylesheet">
<link href="{SHUAFEN_STATICS_PATH}css/fileinput.css"
	rel="stylesheet">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
      <script src="http://cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="http://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
      <script src="http://libs.useso.com/js/html5shiv/3.7/html5shiv.min.js"></script>
    <![endif]-->
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="{SHUAFEN_STATICS_PATH}js/lib/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="{SHUAFEN_STATICS_PATH}js/lib/bootstrap.min.js"></script>
<script src="{SHUAFEN_STATICS_PATH}js/lib/bootstrapValidator.min.js"></script>
<script src="{SHUAFEN_STATICS_PATH}js/lib/fileinput.min.js"></script>
<script src="{SHUAFEN_STATICS_PATH}js/lib/fileinput_locale_zh.js"></script>
<script src="{SHUAFEN_STATICS_PATH}js/lib/style.js"></script>
<script type="text/javascript">
	//初始化表单验证
	$(function (){
		$('#fm').bootstrapValidator({
		       live: 'disabled',
		       message: '输入有误',
		       feedbackIcons: {
		           valid: 'glyphicon glyphicon-ok',
		           invalid: 'glyphicon glyphicon-remove',
		           validating: 'glyphicon glyphicon-refresh'
		       },
		       fields : {
		    	   "nickname" : {
		    		 validators : {
		    			 notEmpty : {
		    				 message : '<span style="font-size:1.2em;">昵称不能为空！</span>'
		    			 }
		    		 }  
		    	   },
		    	   "telephone" : {
		    		   validators : {
		    			   notEmpty : {
		    				   message : '<span style="font-size:1.2em;">电话号码不能为空！</span>'
		    			   },
		    			   regexp:{
		    			   		regexp:/^\d{11}$/,
		    			   		message:'<span style="font-size:1.2em;">请输入正确的电话号码！</span>'
		    			   },
						   remote: {
							   message:'<span style="font-size:1.2em;">该手机号已经注册！</span>',
							   url: 'index.php?m=shuafen&c=web&a=checkUsername',
							   data:{username:'telephone'}
						   }
		    		   }
		    	   },
		           "password": {
		               validators: {
		                   notEmpty: {
		                       message: '<span style="font-size:1.2em;">密码不能为空！</span>'
		                   }
		               }
		           },
		           "code" : {
		        	   validators: {
		                   notEmpty: {
		                       message: '<span style="font-size:1.2em;">验证码不能为空！</span>'
		                   }
		               }
		           },
				   "province":{
					   validators: {
						   notEmpty: {
							   message: '<span style="font-size:1.2em;">请选择所在省份！</span>'
						   }
					   }
				   },
				   "city":{
					   validators: {
						   notEmpty: {
							   message: '<span style="font-size:1.2em;">请选择所在城市！</span>'
						   }
					   }
				   },
				   "industry_one":{
					   validators: {
						   notEmpty: {
							   message: '<span style="font-size:1.2em;">请选择一级行业！</span>'
						   }
					   }
				   },

		       }
		});
	});
	//当页面加载完成后，初始化一级行业列表
	var option = '<option value="">请选择行业</option>';
	$(function (){
		setup();
		//preselect('河南省','新乡市');

		$.ajax({
			url : 'index.php?m=shuafen&c=web&a=getIndustry',
			method : 'get',
			success : function (rs){
				$("#level_1").append(option);
				for (var i = 0; i < rs.length; i ++) {
					$("#level_1").append('<option value="'+rs[i].id+'">'+rs[i].industry_name+'</option>');
				}
			},
			dataType : 'json'
		});
		$("#industry").on("change",'#level_1',function (){
			initIndustry($(this).val(),'level_2');
		});
		$("#industry").on("change",'#level_2',function (){
			initIndustry($(this).val(),'level_3');
		});
	});
	function initIndustry(pid,level){
		if(!pid) return;
		$("#"+level).parent().remove();
		$("#level_3").parent().remove();
		var industry_type_name = level=='level_2'?'二级行业':'三级行业';
		var industry_id_name = level=='level_2'?'industry_two':'industry_three';

		$.ajax({
			url : 'index.php?m=shuafen&c=web&a=getIndustry&pid='+pid,
			method : 'get',
			success : function (rs){
				if(!rs.length){
					return;
				}
				var str = '<div class="form-group input-group">'+
						'<span class="input-group-addon">'+industry_type_name+'</span>'+
						'<select id="'+level+'" class=" form-control" name="'+industry_id_name+'"></select>'+
						'</div>';
				$("#industry").append(str);
				$("#"+level).append(option);
				for (var i = 0; i < rs.length; i ++) {
					$("#"+level).append('<option value="'+rs[i].id+'">'+rs[i].industry_name+'</option>');
				}

				$('#fm').bootstrapValidator('addField', industry_id_name, {
					validators: {
						notEmpty: {
							message: '<span style="font-size:1.2em;">请选择'+industry_type_name+'！</span>'
						}
					}
				});
			},
			dataType : 'json'
		});
	}


</script>
</head>
<body style="margin:5px;">
	<p class="bg-primary" style="padding: 15px;font-weight: bold;font-size: 14px;    background-color: #d9534f;">请注册时准确填写各项信息,以免影响效果</p>
	<div class="prolist">
		<form id="fm"  method="post" action="index.php?m=shuafen&c=web&a=register">
			<div class="form-group input-group">
				<span class="input-group-addon">昵称</span> <input type="text"
					id="nickName" name="nickname" class="form-control"
					placeholder="请输入昵称" />
			</div>
			<div class="form-group input-group">
				<span class="input-group-addon">手机</span> <input type="number"

					id="telephone" name="telephone" class="form-control"
					placeholder="绑定微信手机号" />
			</div>
			<div style="font-size:0.8em;text-align:right;margin-right:5px;">密码仅供本网站登录使用</div>
			<div class="form-group input-group">
				<span class="input-group-addon">密码</span> <input type="password"
					id="password" name="password" class="form-control" />
			</div>
			<div class="form-group input-group">
				<span class="input-group-addon">性别</span>
				<div class="form-control">
					<label class="checkbox-inline"> <input type="radio"
						name="sex" id="gender_man" value="0" checked>男
					</label> <label class="checkbox-inline"> <input type="radio"
						name="sex" id="gender_woman" value="1"> 女
					</label>
				</div>
			</div>
			<div class="form-group input-group">
				<span class="input-group-addon">省份</span>
				<select id="s1" class="form-control" name="province"></select>

			</div>
			<div class="form-group input-group">
				<span class="input-group-addon">城市</span> <select id="s2"
					name="city" class="form-control">
				</select>
			</div>
			<div id="industry">
				<div class="form-group input-group">
					<span class="input-group-addon">一级行业</span>
					<select id="level_1" name="industry_one" class=" form-control">
				</select>
				</div>
			</div>


			<div class="form-group input-group">
				<span class="input-group-addon">头像</span>
				<select class="form-control" name="img" onchange="javascript:document.getElementById('imgBox').src='{SHUAFEN_STATICS_PATH}/images/avatar/'+this.value">
					<?php for($i=10;$i<=20;$i++){?>
					<option value="<?php echo $i;?>.jpg">photo_<?php echo $i;?></option>
					<?php }?>
				</select>
				<img src="{SHUAFEN_STATICS_PATH}/images/avatar/10.jpg" id="imgBox"/>
			</div>
			<div class="form-group input-group">
				<span class="input-group-addon">密保问题</span>
				<select  class="form-control" name="security_question">
					<option value="你母亲是谁?">你母亲是谁?</option>
					<option value="你父亲是谁?">你父亲是谁?</option>
					<option value="你配偶是谁?">你配偶是谁?</option>
					<option value="你偶像是谁?">你偶像是谁?</option>
				</select>
			</div>
			<div class="form-group input-group">
				<span class="input-group-addon">密保答案</span>
				<input type="text"   name="security_answer" class="form-control"/>
			</select>
			</div>
			<div style="color:red;font-size:14px;text-align: center;">
				<?php echo $message ?>
			</div>
			<div class="form-group input-group">
				<span class="input-group-addon">验证码</span>
				<input type="text" id="code" name="code" size="10">
				{form::checkcode('code_img', '4', '14', 100, 30)}
			</div>

			<input name="dosubmit" type="submit" class="btn btn-primary btn-lg btn-block"
				value="确认注册" />
				<input type="hidden" name="struts.token.name" value="token" />
<input type="hidden" name="token" value="GNKIGDWPVFTNK0A0MEJ9GPOKHXBLL1Q4" />
		</form>
		<div class="clearfix"></div>
	</div>
	<!--prolist/-->
	<div class="heights">&nbsp;</div>
	<!-- 模态框（Modal） -->
	<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
		<div class="modal-dialog">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal"
						aria-hidden="true">&times;</button>
					<h4 class="modal-title" id="myModalLabel">报名信息错误</h4>
				</div>
				<div class="modal-body" id="modelText"></div>
				<div class="modal-footer">
					<button type="button" class="btn btn-default" data-dismiss="modal">关闭
					</button>
				</div>
			</div>
			<!-- /.modal-content -->
		</div>
		<!-- /.modal -->
	</div>
	<script src="<?php echo JS_PATH?>city.js"></script>
</body>
</html>